export type METHOD_TYPE = 'get' | 'GET' | 'post' | 'POST' | 'delete' | 'DELETE' | 'put' | 'PUT' | 'options' | 'OPTIONS'
export interface AxiosRequestConfig {
  url?: string,
  method?: METHOD_TYPE,
  // params?: Record<string, any>
  params?: any,
  data?: Record<string, any>,
  headers?: Record<string, any>,
  timeout?: number
}

export interface AxiosInterceptorManager<T = any> {

}

// Promise的泛型T是promise成功态response的类型
export interface AxiosInstance {
  <T>(config: AxiosRequestConfig): Promise<AxiosResponse<T>>,
  interceptors: {
    request: AxiosInterceptorManager<AxiosRequestConfig>;
    response: AxiosInterceptorManager<AxiosResponse>;
  }
}

// 泛型T是响应体的类型
export interface AxiosResponse<T = any> {
  data: T,
  status: number,
  statusText: string,
  config?: AxiosRequestConfig,
  headers?: Record<string, any>,
  request?: XMLHttpRequest
}